class Agent:
    def __init__(self, cfg_path: str):
        from .config import get_config
        self.cfg = get_config(cfg_path)

        from .sche import JobScheduler, TaskScheduler
        self.job_scheduler = JobScheduler(self)
        self.task_scheduler = TaskScheduler(self)

        from .db.async_engine import AsyncAlembicDbEngine
        self.db = AsyncAlembicDbEngine(self.cfg.base.db_url, self.cfg.base.alembic_db_url, **self.cfg.base.url_args)

        self.is_unique_running: bool = False

    async def start(self):

        self.job_scheduler.start()
        self.task_scheduler.start()

    async def stop(self):
        self.job_scheduler.shutdown()
        self.task_scheduler.shutdown()
        self.db.close()
